import request from '@/utils/request'
// 请求营业额
export const orderTurnover = (begin, end) => {
  return request({
    url: '/report/turnoverStatistics',
    params: {
      begin,
      end,
    },
  })
}
// 请求用户数据
export const orderUser = (begin, end) => {
  return request({
    url: '/report/userStatistics',
    params: {
      begin,
      end,
    },
  })
}
// 请求订单数据
export const orderOrder = (begin, end) => {
  return request({
    url: '/report/ordersStatistics',
    params: {
      begin,
      end,
    },
  })
}
// 请求商品销量数据
export const orderGoods = (begin, end) => {
  return request({
    url: '/report/top10',
    params: {
      begin,
      end,
    },
  })
}
// 请求使用商品数据
export const AllOrders = (pageNumber) => {
  return request({
    url: '/admin/order/list',
    params: {
      pageNumber,
    },
  })
}
// 根据订单状态查询订单数据
export const orderState = (status, pageNumber) => {
  return request({
    url: `/admin/order/listByStatus/${status}/${pageNumber}`,
  })
}
// 根据条件查询订单数据
export const orderCondition = ({
  number,
  phone,
  startOrderTime,
  endOrderTime,
  status,
  pageNumber,
}) => {
  return request({
    url: '/admin/order/searchOrders',
    params: {
      number,
      phone,
      startOrderTime,
      endOrderTime,
      status,
      pageNumber,
    },
  })
}
// 根据订单号查询订单详情
export const orderDetail = (id) => {
  return request({
    url: `/admin/orderDetail/list`,
    params: {
      orderId: id,
    },
  })
}
// 根据订单号修改订单状态
export const orderChangeStatus = (id, status) => {
  return request({
    url: `/admin/order/updateStatus/${id}/${status}`,
    method: 'put',
  })
}
